home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java Primer Plus
/
Java Primer Plus (Waite Group Proess)(1996).iso
/
chapter8
/
factorial.java
< prev
next >
Wrap
Text File
|
1995-12-31
|
278b
|
18 lines
/* Recursive factorial example */
class factorial {
public static void main(String args[]) {
System.out.println(fac(5));
}
public static long fac (int value) {
if (value == 1) return 1L;
return value * fac(value-1);
}
}